package net.oschina.simpleplus.erpc.producer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import net.oschina.simpleplus.erpc.Launcher;
import net.oschina.simpleplus.erpc.proto.ERpcRequestMessage.IntegerERpc;
import net.oschina.simpleplus.erpc.sample.api.TestCalService;

public class Producer {

	private static final Logger logger = LoggerFactory.getLogger(Producer.class);
	
	public static void main(String[] args) {
		Launcher client = new ERpcClient();
		try {
			client.start("127.0.0.1", 10000);
			IntegerERpc eRpc = new ERpcProxy(client).create(TestCalService.class).add(1000, 10000);
			logger.info("result:{}", eRpc);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		try {
			Thread.sleep(10000);
			client.shutdown();
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
}
